<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <div class="login-panel">
    <h1 class="title">小贝后台管理系统</h1>
    <el-tabs type="border-card" stretch v-model="activeName">
      <!--账号登录-->
      <el-tab-pane name="account">
        <template #label>
          <span class="icon">
            <el-icon><UserFilled /></el-icon>
            <span class="text">账号登录</span>
          </span>
        </template>

        <pane-account ref="accountRef" />
      </el-tab-pane>

      <!--手机登录-->
      <el-tab-pane name="phone">
        <template #label>
          <span class="icon">
            <el-icon><Cellphone /></el-icon>
            <span class="text">手机登录</span>
          </span>
        </template>

        <pane-phone />
      </el-tab-pane>
    </el-tabs>
    <div class="control-account">
      <el-checkbox v-model="remPass" label="记住密码" size="large" />
      <el-link type="primary">忘记密码</el-link>
    </div>
    <el-button class="login-btn" type="primary" size="large" @click="handleLoginBthClick">立即登录</el-button>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import PaneAccount from './pane-account.vue'
import PanePhone from './pane-phone.vue'

const activeName = ref('account')
const remPass = ref(false)

const accountRef = ref<InstanceType<typeof PaneAccount>>()

function handleLoginBthClick() {
  if (activeName.value === 'account') {
    accountRef.value?.loginAction()
  } else {
    console.log('用户在进行手机登录')
  }
}
</script>

<style lang="less" scoped>
.login-panel {
  width: 330px;
  margin-bottom: 150px;

  .title {
    text-align: center;
    margin-bottom: 15px;
  }

  .icon {
    display: flex;
    align-items: center;
    justify-content: center;

    .text {
      margin-left: 5px;
    }
  }

  .control-account {
    margin-top: 12px;
    display: flex;

    justify-content: space-between;
  }

  .login-btn {
    margin-top: 10px;
    width: 100%;
    // --el-button-large: 50px !important;
  }
}
</style>
